import { Vector2, Vector3, Matrix4, Quaternion } from "@nirvana/math";

console.log("form math...");

const q = new Quaternion();
q.rotationX(Math.PI / 4.0);

const q1 = q.clone();
q.multiply(q1);

const q2 = new Quaternion();
q2.rotationX(Math.PI / 2.0);

const q3 = new Quaternion();
q3.rotateX(Quaternion.e, Math.PI / 4);
q3.rotateX(q3, Math.PI / 4);

const q4 = new Quaternion();
q4.fromEuler(Math.PI / 2.0, 0, 0);

const q5 = new Quaternion();
q5.rotateX(Quaternion.e, Math.PI / 2);
q5.rotateY(q5, Math.PI / 2);
q5.rotateZ(q5, Math.PI / 2);

const q6 = Quaternion.e;
const q6x = Quaternion.e;
const q6y = Quaternion.e;
const q6z = Quaternion.e;
q6x.rotationX(Math.PI / 2);
q6y.rotationY(Math.PI / 2);
q6z.rotationZ(Math.PI / 4);

q6.multiply(q6x).multiply(q6y).multiply(q6z);

const q7 = new Quaternion();
q7.fromEuler(Math.PI / 2.0, Math.PI / 2.0, Math.PI / 4);

console.log(q6, q7);

const m3 = q6.toMatrix3();
const q8 = Quaternion.e;
q8.fromMatrix3(m3);
console.log(q7, q8);
// console.log(q5, q7);

// const q9 = new Quaternion();
// q9.fromEuler();

setInterval(() => {
  // console.log(q7.check(), q6.check());
  // q.rotateX(q, 1);
}, 2000);
